// dtree.h
// -------
// Eric Huang
// Bohao (Dan) Pan

#ifndef DTREE_H
#define DTREE_H

#include "dtree_util.h"

#define DATASIZE 100
#define DATAFILE "bcw.dat"
#define NOISYFILE "noisy.dat"
#define NONE -1

// The DecisionTree data structure
typedef struct decision_tree {
  int attrib;
  int classifier;
  struct decision_tree **children;
} DecisionTree;

typedef struct Hypothesis{
	DecisionTree *tree;
	float alpha;
};

typedef struct Hypotheses {
	Hypothesis *h;
	int num_h;
};

// Function Declarations
int Classify(DatasetDescription DD, DecisionTree *node, int *attribs);
DecisionTree *Learn(DatasetDescription DD, inst *dataset, int n, int learnerDepth);
DecisionTree *ID3(DatasetDescription DD, inst *dataset, 
int *usedAttribs, int n, int depth);
float *CountClasses(DatasetDescription DD, inst *dataset, int n);
int BestAttrib(DatasetDescription DD, inst *dataset, int *usedAttribs, int n);
double Remainder(int attrib, DatasetDescription DD, inst *dataset, int n);
double Entropy(DatasetDescription DD, inst *dataset, int n);
DecisionTree *MakeLeaf(int classification);
DecisionTree *MakeNode(DatasetDescription DD, int attrib);
void FreeTree(DatasetDescription DD, DecisionTree *tree);
void FreeHypotheses(DatasetDescription DD, Hypotheses *hh);

#endif
